
<div class="right">
  <div id="columns1">
    <ul id="column2" class="main">
      <li class="widget1 color-green1" id="widget12">
        <div class="widget1-head">
          <h3> 修改关键字 </h3>
        </div>
        <div class="widget1-content">
          <form name="frmGuanjianci" method="post" action="<?=$this->config->item('site_url')?>SystemFunctions/saveKeyWord">
            <span class="STYLE1"></span>
            <h3>*请填写您竞价的搜索引擎对应的关键词：</h3>
            <BR>
           
            <p>百度关键词：
            <table id="tb_baidu" style="border:1px solid #000; width:100%">
              <tr>
                <td colspan="4" style="text-align:right"><input id="BtAdd_baidu" type="button" value="添加" />
                  &nbsp;
                  <input id="BtDel_baidu" type="button" value="删除" /></td>
              </tr>
              <tr>
                <td style="text-align: center;width:20%;">&nbsp;&nbsp;</td>
                <td style="text-align: center;width:20%;"><input id="CKA_baidu" name="CKA" type="checkbox"/>
                  全选</td>
                <td style="text-align: center;width:20%;"> 关键词</td>
                <td style="text-align: center;width:20%;"> 单价</td>
              </tr>
			   <tr>
                <td style="text-align: center">1</td>
                <td style="text-align: center"><input id="CK" type="checkbox" name="baidu_ck[]"/></td>
                <td style="text-align: center"><input id="TName" type="text" name="baidu_keywords[]"  value=""/></td>
                <td style="text-align: center"><input id="TRm" type="text" name="baidu_key_money[]" value=""/></td>
              </tr>
			  <?php 
			  if(!empty($baidu['data']))
			  {
			 	 $i=1;
			  foreach($baidu['data'] as $key=>$val):?>
			  <?php $i=$i+1;?>
              <tr>
                <td style="text-align: center"><?=$i?></td>
                <td style="text-align: center"><input id="CK" type="checkbox" name="baidu_ck[]" value="<?=$val['id']?>"/></td>
                <td style="text-align: center"><input id="TName" type="text" name="baidu_keywords[]"  value="<?=$val['keyword']?>"/></td>
                <td style="text-align: center"><input id="TRm" type="text" name="baidu_key_money[]" value="<?=$val['price']?>"/></td>
              </tr>
			  <?php endforeach; 
			  	}
			  ?>
            </table>
            </p>
            <p>谷歌关键词：
              <table id="tb_google" style="border:1px solid #000; width:100%">
              <tr>
                <td colspan="4" style="text-align:right"><input id="BtAdd_google" type="button" value="添加" />
                  &nbsp;
                  <input id="BtDel_google" type="button" value="删除" /></td>
              </tr>
              <tr>
                <td style="text-align: center;width:20%;">&nbsp;&nbsp;</td>
                <td style="text-align: center;width:20%;"><input id="CKA_google" name="CKA" type="checkbox"/>
                  全选</td>
                <td style="text-align: center;width:20%;"> 关键词</td>
                <td style="text-align: center;width:20%;"> 单价</td>
              </tr>
			  <tr>
                <td style="text-align: center">1</td>
                <td style="text-align: center"><input id="CK" type="checkbox" name="google_ck[]"/></td>
                <td style="text-align: center"><input id="TName" type="text" name="google_keywords[]" value=""/></td>
                <td style="text-align: center"><input id="TRm" type="text" name="google_key_money[]" value=""/></td>
              </tr>
			  <?php 
			 if(!empty($google['data']))
			  {
			  $j=1;
			  foreach($google['data'] as $key=>$val):?>
			  <?php $j=$j+1;?>
              <tr>
                <td style="text-align: center"><?=$j?></td>
                <td style="text-align: center"><input id="CK" type="checkbox" name="google_ck[]"/></td>
                <td style="text-align: center"><input id="TName" type="text" name="google_keywords[]" value="<?=$val['keyword']?>"/></td>
                <td style="text-align: center"><input id="TRm" type="text" name="google_key_money[]" value="<?=$val['price']?>"/></td>
              </tr>
			   <?php endforeach; 
			   }
			   ?>
            </table>
            </p>
            <p>搜狗关键词：
              <table id="tb_sougou" style="border:1px solid #000; width:100%">
              <tr>
                <td colspan="4" style="text-align:right"><input id="BtAdd_sougou" type="button" value="添加" />
                  &nbsp;
                  <input id="BtDel_sougou" type="button" value="删除" /></td>
              </tr>
              <tr>
                <td style="text-align: center;width:20%;">&nbsp;&nbsp;</td>
                <td style="text-align: center;width:20%;"><input id="CKA_sougou" name="CKA" type="checkbox"/>
                  全选</td>
                <td style="text-align: center;width:20%;"> 关键词</td>
                <td style="text-align: center;width:20%;"> 单价</td>
              </tr>
			  <tr>
                <td style="text-align: center">1</td>
                <td style="text-align: center"><input id="CK" type="checkbox" name="sogou_ck[]"/></td>
                <td style="text-align: center"><input id="TName" type="text" name="sogou_keywords[]" /></td>
                <td style="text-align: center"><input id="TRm" type="text" name="sogou_key_money[]" /></td>
              </tr>

			  <?php 
			  	if(!empty($sogou['data'])){
					$s=1;
				foreach($sogou['data'] as $key=>$val):?>
			  <?php $s=$s+1;?>
              <tr>
                <td style="text-align: center"><?=$s?></td>
                <td style="text-align: center"><input id="CK" type="checkbox" name="sogou_ck[]"/></td>
                <td style="text-align: center"><input id="TName" type="text" name="sogou_keywords[]" value="<?=$val['keyword']?>"/></td>
                <td style="text-align: center"><input id="TRm" type="text" name="sogou_key_money[]" value="<?=$val['price']?>"/></td>
              </tr>
			   <?php endforeach; 
			   }
			   ?>
            </table>
            </p>
            <br/>
            <center>
              <strong style="font-fiamlly:'宋体'; font-size:12px;">
              <input type="submit" value="确认修改"
							style="border: 1px #FFFFFF solid; background: #efefef;style=cursor:pointer" />
              </strong>
            </center>
            </tr>
            </td>
            <input type="hidden" value="<?=@$baidu['searcher_ids']?>" name="bak_baidu">
			<input type="hidden" value="<?=@$google['searcher_ids']?>" name ="bak_google">
			<input type="hidden" value="<?=@$sogou['searcher_ids']?>" name ="bak_sogou">
          </form>
        </div>
      </li>
      <li class="widget1 color-green1" id="widget13" style="visibility:hidden;">
        <div class="widget1-head" style="height:0px;">
          <h3> 修改关键字 </h3>
        </div>
        <div class="widget1-content"> </div>
      </li>
    </ul>
  </div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
	//隐藏模板tr
	//$("#tb_baidu tr").eq(2).hide();
	var i = <?=$baidu['count']?>+1;
	$("#BtAdd_baidu").click(function() {
　　　　　//复制一行
		var tr = $("#tb_baidu tr").eq(2).clone();
		tr.find("td").get(0).innerHTML = ++i;
		tr.show();
		tr.appendTo("#tb_baidu");
	});
	$("#BtDel_baidu").click(function() {
		$("#tb_baidu tr:gt(2)").each(function() {
			if ($(this).find("#CK").get(0).checked == true) {
				$(this).remove();
			}
		});
		i = <?=$baidu['count']?>;
		$("#tb_baidu tr:gt(2)").each(function() {
			$(this).find("td").get(0).innerHTML = ++i;
		});
		$("#CKA_baidu").attr("checked", false);
	});
	$("#CKA_baidu").click(function() {
		$("#tb_baidu tr:gt(1)").each(function() {
			$(this).find("#CK").get(0).checked = $("#CKA_baidu").get(0).checked;
		});
	});

/*google*/	
	//隐藏模板tr
//	$("#tb_google tr").eq(2).hide();
	var g = <?=$google['count']?>+1;
	$("#BtAdd_google").click(function() {
　　　　　//复制一行
		var tr = $("#tb_google tr").eq(2).clone();
		tr.find("td").get(0).innerHTML = ++g;
		tr.show();
		tr.appendTo("#tb_google");
	});
	$("#BtDel_google").click(function() {
		$("#tb_google tr:gt(2)").each(function() {
			if ($(this).find("#CK").get(0).checked == true) {
				$(this).remove();
			}
		});
		g = <?=$google['count']?>;
		$("#tb_google tr:gt(2)").each(function() {
			$(this).find("td").get(0).innerHTML = ++i;
		});
		$("#CKA_google").attr("checked", false);
	});
	$("#CKA_google").click(function() {
		$("#tb_google tr:gt(1)").each(function() {
			$(this).find("#CK").get(0).checked = $("#CKA_google").get(0).checked;
		});
	});		

/*sougou*/	
	//隐藏模板tr
//	$("#tb_sougou tr").eq(2).hide();
	var s = <?=$sogou['count']?>+1;
	$("#BtAdd_sougou").click(function() {
　　　　　//复制一行
		var tr = $("#tb_sougou tr").eq(1).clone();
		tr.find("td").get(0).innerHTML = ++s;
		tr.show();
		tr.appendTo("#tb_sougou");
	});
	$("#BtDel_sougou").click(function() {
		$("#tb_sougou tr:gt(2)").each(function() {
			if ($(this).find("#CK").get(0).checked == true) {
				$(this).remove();
			}
		});
		i = <?=$baidu['count']?>;
		$("#tb_sougou tr:gt(2)").each(function() {
			$(this).find("td").get(0).innerHTML = ++i;
		});
		$("#CKA_sougou").attr("checked", false);
	});
	$("#CKA_sougou").click(function() {
		$("#tb_sougou tr:gt(1)").each(function() {
			$(this).find("#CK").get(0).checked = $("#CKA_sougou").get(0).checked;
		});
	});		
})	
	
    </script>
